<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="u" uri="/iuie-tag"%>
<%@ taglib prefix="sys" uri="/sys-tag" %>
<%@ taglib prefix="lui" tagdir="/WEB-INF/tags" %>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>文件模块</title>
<lui:context/>
</head>
<u:View basePath="/res-datum/file" userJS="fileList" userCSS="fileList" delayLoadJs="false" res="base64">
<body style="overflow-y:auto">
<lui:boards>
    <lui:board width="100%" boardTitle="文件管理">
		<!-- 操作搜索栏 -->
	    <div class='t-oper-bar'>
	        <div class="m-form t-uploader">
				<form class="m-cust" method="post" action="${ctx}/datum/file/doUpload" enctype="multipart/form-data" target="uploadIFrm" id='uploadFile'>
			        <iframe id="uploadIFrm" name="uploadIFrm" style="display:none;"></iframe>
					<label class="m-btn m-primary t-upload-btn" for="xFile">上传文件</label><input class='m-file' type="file" id="xFile" 
						name='file' onchange="FileListPage.onFileChanged(this)">
					<button type="submit" class="m-btn m-color-charcoal-grey t-upload-btn t-tag"><i class='fa fa-upload'></i>提交</button>
					<input type="hidden" name='fileType' value='file'>
					<input type="hidden" name='immediately' value='true'>
					<input type="hidden" name='func' value='parent.FileListPage.onUploadSucc'>
	            </form>
	        </div>
			<div class="m-form t-search">
				<!-- 搜索下面ul中的菜单 -->
				<input type="text" name='articleName' autofocus="autofocus" placeholder="搜索文件名" data-type='search' id='searchArticle'><i 
					class='fa fa-search'></i>
			</div>
		</div>
		<form id="findFileInfoFrm" class='m-cust'>
		    <input name="originalName" hidden="hidden"/>
		    <input name="fileType" value="file" hidden="hidden">
		    <u:dropListView id="dropView_oper">
                <u:dropView name="qrcode" template="qrcode" onClick="FileListPage.viewQrcode" title="二维码"/>
                <u:dropView name="download" template="download" onClick="FileListPage.downloadFile" title="下载"/>
                <u:dropView name="undo" template="undo" onClick="FileListPage.repairFileSize" title="更新文件大小"/>
                <u:dropView name="delete" template="delete" onClick="FileListPage.deleteFile" title="删除"/>
            </u:dropListView>
		    <u:dataSet id="fileInfoSet" idField="fileId">
	             <u:dataField display="文件ID" name="fileId" visiable="false"/>
				 <u:dataField display="文件名" name="fileName" visiable="false"/>
				 <u:dataField display="文件原始名称" name="originalName" width="400px" align="left"/>
				 <u:dataField display="上传时间" name="uploadTime" width="135px"/>
			 	 <u:dataField display="文件大小" name="fileSize" width="100px" />
			 	 <u:dataField display="下载次数" name="downloadCount" width="80px" />
			 	 <u:dataField display="访问链接" name="visitLink" align="left"/>
			 	 <u:dataField display="操作" name="oper" dropView="dropView_oper" width="125px"/>
	         </u:dataSet>
	         <!-- 文件删除 -->
	         <lui:ajax url="${ctx }/datum/file/fileDelete" id="fileDeleteAjax" onSuccess="FileListPage.onFileDeleteSucc"/>
	         <!-- 更新下载次数 -->
	         <lui:ajax url="${ctx }/datum/file/updateDownloadCount" id="updateDownloadCountAjax" onSuccess="FileListPage.onUpdateDownloadCountSucc"/>
	         <!-- 获取文件信息列表ajax -->
	         <lui:ajax id="findFileInfoAjax" url="${ctx }/datum/file/findByPage" formQuery="#findFileInfoFrm" formSubmit="true" 
	             onSuccess="FileListPage.onQuerySucc"/>
	         <!-- 修复文件大小 -->
	         <lui:ajax id="repairFileSizeAjax" url="${ctx }/datum/file/repairFileSize/" onSuccess="FileListPage.onRepairSizeSucc"/>
	         <!-- 修改原始文件名 -->
	         <lui:ajax url="${ctx }/datum/file/rename/" id="renameAjax" onSuccess="FileListPage.updateSucc" 
		        contentType="application/x-www-form-urlencoded" type="post"/>
		     <!-- 打开文件夹的ajax -->
		     <lui:ajax id="openFolderAjax" url="${ctx }/datum/file/open/folder/" onSuccess="FileListPage.onOpenSucc" type="post" 
		     	contentType="application/x-www-form-urlencoded" silent="true"/>
		     <!-- 打开文件的ajax -->
		     <lui:ajax id="openFileAjax" url="${ctx }/datum/file/open/file/" onSuccess="FileListPage.onOpenSucc" type="post" 
		     	contentType="application/x-www-form-urlencoded" silent="true"/>
	         <lui:datatable id="fileInfoDatatable" ajax="findFileInfoAjax" sortable="true" pagination="fileInfoPagination" dataset="fileInfoSet"
	             checkable="false" multiple="false" cutLine="true" onRenderItem="FileListPage.onRenderItem" tip="true"/>
	         <lui:pagination datatable="fileInfoDatatable" id="fileInfoPagination" pageSize="15" pageChoice="15" showPageChoice="false"/>
		</form>
	</lui:board>
</lui:boards>
</body>
</u:View>
</html>